Proper test automation can improve software quality and efficiency of software development. A test program usually includes many test cases, which are tested on some test fixtures. A test fixture is a determined running background of a known set of objects and states.
One difficulty found for test automation for a mobile infrastructure based solution is to set up test fixtures. A mobile infrastructure based solution usually contains three parts: the server side, the client side, and the middle part which includes mobile infrastructure middleware and client framework for exchanging data between the server and the client.
One approach to solving this problem is to avoid test fixtures, and design test cases working with all sets of data. This might work for testing some simple logic. But it does not work or will involve significant efforts to create test cases for complex logic, e.g., an inventory handling with different unit of measurements, which requires significant programming of complex test logic to create data irrelevant test cases.
Another approach is to isolate data persistence by creating mock objects. This could be achieved by implementing interfaces over the data persistence layer or business logic layer, and creating and returning mock objects without touching underlying mobile infrastructure data persistence. The disadvantages of this approach include that: it needs significant programming of application specific mock objects to simulate test fixtures, it is not general across applications, data generating logics are not separated from test cases, and test environment is very different from real environment, etc.
A further approach is to set up data fixtures at the server side and then download them to the client side. However, the complexity and huge data/customizing dependencies on the server side make it difficult to set up and reproduce fixed data set for client unit test purpose. In addition, in the case of server change or migration, test cases may be broken.
However, one problem for setting up test fixtures from the client side is the authority to create data from the client side. Mobile infrastructure contains a data persistence and synchronization framework to synchronize data between a client and a server. The data persistence and synchronization framework has a data meta definition to define the table and field structure on the client side. In order to prevent unintended operations by application programs, the data meta definition can restrict the authority to create, modify or delete data in data tables from the client side. For example, data in the material master table is not allowed to be created from the client side. This authority restriction, although a good design practice, makes it impossible for a test automation program to create test data freely using normal program interfaces provided by mobile infrastructure.
Further, data exchange messages between the server and the client are in XML format, which contains information like table name, actions, record ID, data record field values, etc. However, it is difficult to maintain data in the XML format. For example, it would be difficult, without spending large efforts on developing a proprietary tool, to perform the following common maintenance tasks on data in the XML format:
1) To have an overview list of all records, sorted by certain fields.
2) To apply changes to the same field of all records, e.g., applying a fixed value, or incremental values.
3) When an application program is upgraded, data model may need to be enhanced, e.g., additional fields are required to be added to a table for new functions. In such a data model enhancement during application migration, it would cost significant efforts to maintain test data in XML format.
The mobile infrastructure test layer is a unit test layer for testing mobile infrastructure, not for testing applications based on mobile infrastructure. Its test focus is network functionality and protocol correctness, instead of correctness of application logic. Test data is maintained in raw messages in XML format, and significant efforts are required for data maintenance. Additionally, there is no data capture concept or end-to-end integrated build process concept in the mobile infrastructure test layer.
Thus, it would be desirable to provide a test automation method which is applicable to mobile infrastructure based applications, and all other software programs as well.